home *** CD-ROM | disk | FTP | other *** search
- Path: news.spies.com!usenet
- From: Erik Max Francis <max@alcyone.com>
- Newsgroups: comp.lang.c
- Subject: Re: routine for yesterday's date
- Date: Sun, 31 Mar 1996 20:13:18 -0800
- Organization: Alcyone Systems
- Message-ID: <315F57DE.30A14E31@alcyone.com>
- References: <315c4d0f.19874776@ottnews.shl.com> <1996Mar30.043002.19054@sq.com> <Dp3B56.FKI@alisa.org>
- NNTP-Posting-Host: newton.alcyone.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.01 (X11; I; Linux 1.2.13 i486)
-
- John J. Rushford wrote:
-
- > Why bother with mktime() when it is so much easier to use the following and
- > you don't have to bother with errors gotten from x.tm_day--;
- >
- > long ticks
- > struct tm * dt;
- >
- > time(&ticks);
- >
- > /* 86400 seconds in a day */
- > ticks -= 86400
- >
- > dt = localtime (&ticks);
-
- That would be great if the time_t value were measured in seconds elapsed since
- some reference time. Then a change in 86 400 s would represent one day.
-
- However, it doesn't. ANSI C 1990, 7.12.2.4:
-
- The `time' function determines the current calendar time. The encoding
- of the value is unspecified.
-
- --
- Erik Max Francis &tSftDotIotE && http://www.alcyone.com/max && max@alcyone.com
- San Jose, California, U.S.A. && 37 20 07 N 121 53 38 W && the 4th R is respect
- H.3`S,3,P,3$S,#$Q,C`Q,3,P,3$S,#$Q,3`Q,3,P,C$Q,#(Q.#`-"C`- && 1love && folasade
- Omnia quia sunt, lumina sunt. && Dominion, GIGO, GOOGOL, Omega, Psi, Strategem
- "Out from his breast/his soul went to seek/the doom of the just." -- _Beowulf_
-